﻿#region

using core;
using System.Linq;
using System.Collections.Generic;

#endregion

namespace appengine.account
{
    internal class purchaseSkin : RequestHandler
    {
        //X.16.0 Skin prices by Sebafra
        public List<ItemCostItem> Prices
        {
            get
            {
                return new List<ItemCostItem>
                {
                    #region "Skin Prices"
                    new ItemCostItem {Type="1025", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="1026", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="19371", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="1028", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="1029", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="1030", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="1027", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5968", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10966", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5969", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="8971", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29770", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="29771", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="10937", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="6005", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29786", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29787", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29788", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29789", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="29790", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="29791", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="29799", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="29800", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="29801", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="32701", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29808", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="29809", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="29810", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="29811", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="29813", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="29814", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="29815", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="29816", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="29817", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="29818", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="10961", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5911", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5997", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29840", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="29841", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="29842", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="29843", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29844", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29845", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="29846", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="8855", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="29848", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="9030", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="10930", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10931", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10932", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10933", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10934", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10935", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10936", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="6004", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10938", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10940", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10941", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10942", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10943", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10944", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10959", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="10960", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19153", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="10962", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19155", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19156", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19157", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19158", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="10967", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="10968", Puchasable=0, Expires=0, Price = 5000},
                    new ItemCostItem {Type="10969", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="10970", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="10971", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="10972", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="10973", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="10974", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19152", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5859", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5860", Puchasable=0, Expires=0, Price = 5000},
                    new ItemCostItem {Type="5861", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5862", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5863", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="5864", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="5865", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5866", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="19154", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="10963", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5878", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5879", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5880", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="10964", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="10965", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="8964", Puchasable=1, Expires=0, Price = 1500},
                    new ItemCostItem {Type="8965", Puchasable=1, Expires=0, Price = 1500},
                    new ItemCostItem {Type="8966", Puchasable=1, Expires=0, Price = 1500},
                    new ItemCostItem {Type="8967", Puchasable=1, Expires=0, Price = 1500},
                    new ItemCostItem {Type="8968", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="8969", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="8970", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="19159", Puchasable=0, Expires=0, Price = 5000},
                    new ItemCostItem {Type="8972", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="8973", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="8974", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="8975", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="8976", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="8977", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="8978", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="8979", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="5909", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5910", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="2521", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5912", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5913", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5914", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5915", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="902", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="6023", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="6003", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="904", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="9012", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="9013", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="9014", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="6025", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="312", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="313", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="834", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="9027", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="836", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="837", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="838", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="9031", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="840", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="841", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="842", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="843", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="844", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="845", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="846", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="847", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="848", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="849", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="850", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="851", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="852", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="853", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="854", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="855", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="856", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="912", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="32657", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="872", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="5994", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5995", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5996", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="32658", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5998", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5999", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="6000", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="6001", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="6002", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="883", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="884", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="885", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="6006", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="6007", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="888", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="898", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="899", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="900", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="901", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="6022", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="903", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="6024", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="905", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="6026", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="29847", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="9026", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="32654", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="32656", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="913", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="914", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="915", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="916", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="917", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="9028", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="9029", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="32675", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="32676", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="32677", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="8614", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="19370", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="839", Puchasable=1, Expires=0, Price = 900},
                    new ItemCostItem {Type="19372", Puchasable=0, Expires=0, Price = 5000},
                    new ItemCostItem {Type="19373", Puchasable=0, Expires=0, Price = 5000},
                    new ItemCostItem {Type="19374", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19375", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="9032", Puchasable=1, Expires=0, Price = 300},
                    new ItemCostItem {Type="19385", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19387", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19388", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19389", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="19390", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="19391", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19392", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19393", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19394", Puchasable=0, Expires=0, Price = 5000},
                    new ItemCostItem {Type="19403", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="19404", Puchasable=0, Expires=0, Price = 1500},
                    new ItemCostItem {Type="32718", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="19407", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="19409", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19410", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19411", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19412", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19413", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19414", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19415", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19416", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19417", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19418", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19419", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19420", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19421", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19422", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19423", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19424", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19425", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19426", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19427", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19428", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19429", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19430", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19431", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19432", Puchasable=1, Expires=0, Price = 2000},
                    new ItemCostItem {Type="19433", Puchasable=0, Expires=0, Price = 2000},
                    new ItemCostItem {Type="5881", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="5970", Puchasable=0, Expires=0, Price = 100000},
                    new ItemCostItem {Type="835", Puchasable=1, Expires=0, Price = 600},
                    new ItemCostItem {Type="32766", Puchasable=1, Expires=0, Price = 2000}
                    #endregion "Skin Prices"
                };
            }
        }

        protected override void HandleRequest()
        {
            DbAccount acc;
            if (Query["guid"] == null || Query["password"] == null)
                WriteErrorLine("Error.incorrectEmailOrPassword");
            else
            {
                LoginStatus status = Database.Verify(Query["guid"], Query["password"], out acc);
                if (status == LoginStatus.OK)
                {
                    foreach (ItemCostItem item in Prices)
                    {
                        if (item.Type == Query["skinType"] && item.Puchasable == 1)
                        {
                            if (!acc.OwnedSkins.Contains(int.Parse(Query["skinType"])) && acc.Credits >= item.Price)
                            {
                                Database.AddSkin(acc, int.Parse(Query["skinType"]));
                                Database.UpdateCredit(acc, -item.Price);
                                WriteLine("<Success/>");
                            }
                            else
                                WriteErrorLine("Error.alreadyOwnsSkin");
                        }
                    }
                }
                else
                    WriteErrorLine(status.GetInfo());
            }
        }
    }
}